#include <REGX52.H>
#include "BuzzerMusic.h"
#include "Key.h"
#include "Nixie.h"
#include "Timer0.h"
#include "Delay.h"

#define SPEED 400

unsigned char freqSelected = 0;

void main() {
	unsigned char i = 0;
	
	Timer0_Init();
	
	while (1) {
		
		if (i >= GGBondLen)
			i = 0;
		
		freqSelected = GGBond[i];
		i++;
		Delay(SPEED / 4 * GGBond[i]);
		i++;
		TR0 = 0;
		Delay(5);
		TR0 = 1;
		
	}
	
}

void Timer0_Isr(void) interrupt 1
{
	if (freqSelected != 0xFF) {
		TL0 = FreqTable[freqSelected] % 256;
		TH0 = FreqTable[freqSelected] / 256;
		
		BZ = !BZ;
	}
}

